package com.wolfeyes.framework.web.serializer;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

import java.math.BigInteger;

/**
 * @title 自定义的json转对象的映射器构建类
 * @className CustomizeJackson2ObjectMapperBuilderCustomizer
 * @author yanyljava
 * @create 2022-01-14 21:25
 */
public class CustomizeJackson2ObjectMapperBuilderCustomizer implements Jackson2ObjectMapperBuilderCustomizer {
	
	/**
	 * @title 映射器构建的自定义逻辑
	 */
	@Override
	public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
		jacksonObjectMapperBuilder.serializerByType(BigInteger.class, ToStringSerializer.instance);
		jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance);
	}
	
}

